const { BrowserWindow, Menu, shell} = require('electron')

// 定义自定义菜单
  const template = [
    {
      label: "文件",
      submenu: [
        {
          label: "新建窗口",
          // 自定义菜单点击事件
          click: () => {
            const newMainWindow = new BrowserWindow({
              width: 300,
              height: 300,
            })
            newMainWindow.loadFile("./src/new.html");
          }
        }
      ]
    },
    {
      label: "编辑",
      submenu: [
        {
          label: "新建窗口",
        }
      ]
    },
    {
      label: "csdn",
      click() {
        // 点击打开浏览器
        shell.openExternal("https://www.4399.com/");
      }
    }
  ]
  const menu = Menu.buildFromTemplate(template)
  Menu.setApplicationMenu(menu)